

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>The ui module &mdash; pyamp v1.2 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '1.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="pyamp v1.2 documentation" href="index.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="index.html">pyamp v1.2 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-pyamp.ui">
<span id="the-ui-module"></span><h1>The ui module<a class="headerlink" href="#module-pyamp.ui" title="Permalink to this headline">¶</a></h1>
<p>The ui module contains modules pertaining to creating and manipulating
user interfaces. This includes tasks such as: getting input from the user,
and displaying a graphical user interface to the user.</p>
<div class="section" id="module-pyamp.ui.input">
<span id="the-input-module"></span><h2>The input module<a class="headerlink" href="#module-pyamp.ui.input" title="Permalink to this headline">¶</a></h2>
<p>The input module contains modules pertaining to retrieving input from
the user using various methods.</p>
<div class="section" id="module-pyamp.ui.input.evdev">
<span id="the-evdev-module"></span><h3>The evdev module<a class="headerlink" href="#module-pyamp.ui.input.evdev" title="Permalink to this headline">¶</a></h3>
<p>evdev.py</p>
<p>This is a Python interface to the Linux input system&#8217;s event device.
Events can be read from an open event file and decoded into spiffy
python objects. The Event objects can optionally be fed into a Device
object that represents the complete state of the device being monitored.</p>
<p>Copyright (C) 2003-2004 Micah Dowty &lt;<a class="reference external" href="mailto:micah&#37;&#52;&#48;navi&#46;cx">micah<span>&#64;</span>navi<span>&#46;</span>cx</a>&gt;</p>
<p>This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.</p>
<p>This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.</p>
<p>You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</p>
<dl class="class">
<dt id="pyamp.ui.input.evdev.Event">
<em class="property">class </em><tt class="descclassname">pyamp.ui.input.evdev.</tt><tt class="descname">Event</tt><big>(</big><em>timestamp=0</em>, <em>type=0</em>, <em>code=0</em>, <em>value=0</em>, <em>unpack=None</em>, <em>readFrom=None</em><big>)</big><a class="reference internal" href="_modules/pyamp/ui/input/evdev.html#Event"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Event" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents one linux input system event. It can
be encoded and decoded in the &#8216;struct input_event&#8217;
format used by the kernel. Types and codes are automatically
encoded and decoded with the #define names used in input.h</p>
<dl class="method">
<dt id="pyamp.ui.input.evdev.Event.pack">
<tt class="descname">pack</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pyamp/ui/input/evdev.html#Event.pack"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Event.pack" title="Permalink to this definition">¶</a></dt>
<dd><p>Pack this event into an input_event struct in
the local machine&#8217;s byte order.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.evdev.Event.readFrom">
<tt class="descname">readFrom</tt><big>(</big><em>stream</em><big>)</big><a class="reference internal" href="_modules/pyamp/ui/input/evdev.html#Event.readFrom"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Event.readFrom" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the next event from the given file-like object</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.evdev.Event.unpack">
<tt class="descname">unpack</tt><big>(</big><em>s</em><big>)</big><a class="reference internal" href="_modules/pyamp/ui/input/evdev.html#Event.unpack"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Event.unpack" title="Permalink to this definition">¶</a></dt>
<dd><p>Unpack ourselves from the given string,, an
input_event struct in the local byte order.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pyamp.ui.input.evdev.Device">
<em class="property">class </em><tt class="descclassname">pyamp.ui.input.evdev.</tt><tt class="descname">Device</tt><big>(</big><em>filename</em><big>)</big><a class="reference internal" href="_modules/pyamp/ui/input/evdev.html#Device"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Device" title="Permalink to this definition">¶</a></dt>
<dd><p>An abstract input device attached to a Linux evdev device node</p>
<dl class="method">
<dt id="pyamp.ui.input.evdev.Device.poll">
<tt class="descname">poll</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pyamp/ui/input/evdev.html#Device.poll"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Device.poll" title="Permalink to this definition">¶</a></dt>
<dd><p>Receive and process all available input events</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.evdev.Device.readMetadata">
<tt class="descname">readMetadata</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pyamp/ui/input/evdev.html#Device.readMetadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Device.readMetadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Read device identity and capabilities via ioctl()</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.evdev.Device.update_EV_ABS">
<tt class="descname">update_EV_ABS</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/pyamp/ui/input/evdev.html#Device.update_EV_ABS"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Device.update_EV_ABS" title="Permalink to this definition">¶</a></dt>
<dd><p>Scale the absolute axis into the range [-1, 1] using absAxisInfo</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-consoleinput-class">
<h3>The ConsoleInput class<a class="headerlink" href="#the-consoleinput-class" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="pyamp.ui.input.ConsoleInput">
<em class="property">class </em><tt class="descclassname">pyamp.ui.input.</tt><tt class="descname">ConsoleInput</tt><big>(</big><em>callback</em>, <em>conditionFn=&lt;function &lt;lambda&gt; at 0xa099d4c&gt;</em>, <em>exceptionFn=None</em>, <em>logger=None</em><big>)</big><a class="headerlink" href="#pyamp.ui.input.ConsoleInput" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="_generated/pyamp_processes_threading_thread.html#pyamp.processes.threading.thread.Thread" title="pyamp.processes.threading.thread.Thread"><tt class="xref py py-class docutils literal"><span class="pre">pyamp.processes.threading.thread.Thread</span></tt></a></p>
<p>The ConsoleInput class provides the ability to receive input from
a user through the console. This class runs as a separate thread which
monitors the console for input and notifies a callback method in the event
that keyboard input is received.</p>
<p>The callback method must take one argument which is the character that was
read as input. This class also provides the ability to register a callback
function to be called in the event that an exception occurs during the
processing of the thread.</p>
<p>This class implements the <a class="reference internal" href="processes.html#pyamp.processes.Thread" title="pyamp.processes.Thread"><tt class="xref py py-class docutils literal"><span class="pre">pyamp.processes.Thread</span></tt></a>, and the
<tt class="xref py py-class docutils literal"><span class="pre">amp.logging.Loggable</span></tt> interfaces.</p>
<ul>
<li><p class="first">callback &#8211; The function called when input is received</p>
</li>
<li><dl class="first docutils">
<dt>conditionFn &#8211; The function used to determine whether we should</dt>
<dd><p class="first last">continue waiting for input</p>
</dd>
</dl>
</li>
<li><p class="first">exceptionFn &#8211; The functionc called when an exception is encountered</p>
</li>
<li><p class="first">logger &#8211; The logger object</p>
</li>
</ul>
<dl class="classmethod">
<dt id="pyamp.ui.input.ConsoleInput.clearScreen">
<em class="property">classmethod </em><tt class="descname">clearScreen</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.input.ConsoleInput.clearScreen" title="Permalink to this definition">¶</a></dt>
<dd><p>Clear the console screen.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.ui.input.ConsoleInput.getCols">
<em class="property">classmethod </em><tt class="descname">getCols</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.input.ConsoleInput.getCols" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the number of columns for this console screen.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.ui.input.ConsoleInput.getRows">
<em class="property">classmethod </em><tt class="descname">getRows</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.input.ConsoleInput.getRows" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the number of rows for this console screen.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.ui.input.ConsoleInput.getSize">
<em class="property">classmethod </em><tt class="descname">getSize</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.input.ConsoleInput.getSize" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the size of the current console screen.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.ConsoleInput.onCycle">
<tt class="descname">onCycle</tt><big>(</big><em>_increment</em><big>)</big><a class="headerlink" href="#pyamp.ui.input.ConsoleInput.onCycle" title="Permalink to this definition">¶</a></dt>
<dd><p>Called during each cycle of the Thread.</p>
<ul class="simple">
<li>increment &#8211; The current increment number</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.ConsoleInput.onException">
<tt class="descname">onException</tt><big>(</big><em>e</em>, <em>traceback</em><big>)</big><a class="headerlink" href="#pyamp.ui.input.ConsoleInput.onException" title="Permalink to this definition">¶</a></dt>
<dd><p>This function is called in the event that an exception
occurs during the processing of the thread.</p>
<ul class="simple">
<li>e &#8211; The exception</li>
<li>traceback &#8211; The traceback</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.ConsoleInput.onShutdown">
<tt class="descname">onShutdown</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.input.ConsoleInput.onShutdown" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the ConsoleInput Thread is shutdown.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.ConsoleInput.onStart">
<tt class="descname">onStart</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.input.ConsoleInput.onStart" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the ConsoleInput thread is started.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-keys-class">
<h3>The Keys class<a class="headerlink" href="#the-keys-class" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="pyamp.ui.input.Keys">
<em class="property">class </em><tt class="descclassname">pyamp.ui.input.</tt><tt class="descname">Keys</tt><a class="headerlink" href="#pyamp.ui.input.Keys" title="Permalink to this definition">¶</a></dt>
<dd><p>The Keys class contains definitions of various keys.</p>
<dl class="class">
<dt id="pyamp.ui.input.Keys.Control">
<em class="property">class </em><tt class="descname">Control</tt><a class="headerlink" href="#pyamp.ui.input.Keys.Control" title="Permalink to this definition">¶</a></dt>
<dd><p>The Control class contains definitions of various control keys.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-userinput-class">
<h3>The UserInput class<a class="headerlink" href="#the-userinput-class" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="pyamp.ui.input.UserInput">
<em class="property">class </em><tt class="descclassname">pyamp.ui.input.</tt><tt class="descname">UserInput</tt><big>(</big><em>keyboard</em>, <em>debug=False</em><big>)</big><a class="headerlink" href="#pyamp.ui.input.UserInput" title="Permalink to this definition">¶</a></dt>
<dd><p>The UserInput class uses the <tt class="xref py py-mod docutils literal"><span class="pre">amp.ui.input.evdev</span></tt> module to
receive the user&#8217;s keyboard presses given the specific Linux
keyboard device.</p>
<p>This class provides to ability to add a series of callbacks for
specific keyboard presses. These functions will be called in the
event that the key presses occur.</p>
<ul class="simple">
<li>keyboard &#8211; The Linux keyboard device</li>
<li>debug &#8211; True for debugging mode, False otherwise</li>
</ul>
<dl class="method">
<dt id="pyamp.ui.input.UserInput.addCode">
<tt class="descname">addCode</tt><big>(</big><em>key</em>, <em>code</em><big>)</big><a class="headerlink" href="#pyamp.ui.input.UserInput.addCode" title="Permalink to this definition">¶</a></dt>
<dd><p>Add codes for given key press events. The key can be a tuple
where the first index is a list of keys and the second index is a
list of modifiers. Or it can be simply a list of keys, or it can
be a single key.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.UserInput.addCodes">
<tt class="descname">addCodes</tt><big>(</big><em>keys</em><big>)</big><a class="headerlink" href="#pyamp.ui.input.UserInput.addCodes" title="Permalink to this definition">¶</a></dt>
<dd><p>Add codes for given key press events. Each key in the keys
dictionary can be a tuple where the first index is a list of keys
and the second index is a list of modifiers. Or it can be simply a
list of keys, or it can be a single key.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.UserInput.addKey">
<tt class="descname">addKey</tt><big>(</big><em>key</em>, <em>callback</em><big>)</big><a class="headerlink" href="#pyamp.ui.input.UserInput.addKey" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a single key to the key press cases. The key can be a tuple
where the first argument is the list of keys, or a single key, and the
second argument is a list of modifiers. Optionally, is can just be
a list of keys, or it can be a single key.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.UserInput.addKeyList">
<tt class="descname">addKeyList</tt><big>(</big><em>keys</em>, <em>callback</em><big>)</big><a class="headerlink" href="#pyamp.ui.input.UserInput.addKeyList" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a list of keys mapped to a single function. Keys can be a tuple
where the first index the a list of keys, or a single key, and the
second index is the list of modifiers. Or it can be a list of keys, and
finally it can be just a single key.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.UserInput.addKeys">
<tt class="descname">addKeys</tt><big>(</big><em>keys</em><big>)</big><a class="headerlink" href="#pyamp.ui.input.UserInput.addKeys" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a key to the key press cases. The keys is a dictionary of
keys. Each key in the dictionary is a normal tuple form of a key,
and the value of the dictionary key is the callback method.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.UserInput.handleKeyPress">
<tt class="descname">handleKeyPress</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.input.UserInput.handleKeyPress" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle keys that are pressed.</p>
</dd></dl>

</dd></dl>

</div>
</div>
<div class="section" id="module-pyamp.ui.qt">
<span id="the-qt-module"></span><h2>The qt module<a class="headerlink" href="#module-pyamp.ui.qt" title="Permalink to this headline">¶</a></h2>
<p>The qt module contains classes pertaining to creating
graphical user interfaces using PyQt.</p>
<div class="section" id="the-baseview-class">
<h3>The BaseView class<a class="headerlink" href="#the-baseview-class" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="pyamp.ui.qt.BaseView">
<em class="property">class </em><tt class="descclassname">pyamp.ui.qt.</tt><tt class="descname">BaseView</tt><big>(</big><em>name=None</em>, <em>controller=None</em>, <em>mainWindow=None</em>, <em>logData=None</em>, <em>logColor=0</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseView" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="_generated/pyamp_logging_loggable.html#pyamp.logging.loggable.Loggable" title="pyamp.logging.loggable.Loggable"><tt class="xref py py-class docutils literal"><span class="pre">pyamp.logging.loggable.Loggable</span></tt></a>, <a class="reference internal" href="_generated/pyamp_patterns_interfaces_requiredProperties.html#pyamp.patterns.interfaces.requiredProperties.RequiredProperties" title="pyamp.patterns.interfaces.requiredProperties.RequiredProperties"><tt class="xref py py-class docutils literal"><span class="pre">pyamp.patterns.interfaces.requiredProperties.RequiredProperties</span></tt></a></p>
<p>The BaseView class provides a base framework for creating Qt
objects.</p>
<p>It provides several functions that are called in a specific order,
and are to be overridden by subclasses in order to provide a
specific implementation for the BaseView. These functions pertain
to certain aspects of setting up a view and are called in the
following order:</p>
<ol class="arabic simple">
<li>configure()</li>
<li>createLayout()</li>
<li>configureLayout()</li>
<li>setupView()</li>
<li>setupConnections()</li>
</ol>
<p>This class implements the <a class="reference internal" href="logging.html#pyamp.logging.Loggable" title="pyamp.logging.Loggable"><tt class="xref py py-class docutils literal"><span class="pre">pyamp.logging.Loggable</span></tt></a> interface
and provides the ability to specify the <tt class="xref py py-attr docutils literal"><span class="pre">logData</span></tt> object
as well as the <tt class="xref py py-attr docutils literal"><span class="pre">color</span></tt> to use for logging (the default
color is to use a white foreground color).</p>
<ul class="simple">
<li>name &#8211; The name of the BaseView</li>
<li>controller &#8211; The controller for the BaseView</li>
<li>mainWindow &#8211; The main window</li>
<li>logData &#8211; The LogData object</li>
<li>logColor &#8211; The color to use for the logger</li>
</ul>
<dl class="method">
<dt id="pyamp.ui.qt.BaseView.completeSetup">
<tt class="descname">completeSetup</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseView.completeSetup" title="Permalink to this definition">¶</a></dt>
<dd><p>Finish setting up the view.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This function should be overridden by subclasses.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseView.configure">
<tt class="descname">configure</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseView.configure" title="Permalink to this definition">¶</a></dt>
<dd><p>Configure the view.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This function should be overridden by subclasses.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseView.configureLayout">
<tt class="descname">configureLayout</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseView.configureLayout" title="Permalink to this definition">¶</a></dt>
<dd><p>Configure the layout for this view.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This function should be overridden by subclasses.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseView.createLayout">
<tt class="descname">createLayout</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseView.createLayout" title="Permalink to this definition">¶</a></dt>
<dd><p>Create the main layout.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This function should be overridden by subclasses.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseView.setController">
<tt class="descname">setController</tt><big>(</big><em>controller</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseView.setController" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the controller object for this view.</p>
<ul class="simple">
<li>controller &#8211; The controller</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseView.setupConnections">
<tt class="descname">setupConnections</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseView.setupConnections" title="Permalink to this definition">¶</a></dt>
<dd><p>Set up any connections this view requires.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This function should be overridden by subclasses.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseView.setupView">
<tt class="descname">setupView</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseView.setupView" title="Permalink to this definition">¶</a></dt>
<dd><p>Create and set up this view.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This function should be overridden by subclasses.</p>
</div>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-basewidget-class">
<h3>The BaseWidget class<a class="headerlink" href="#the-basewidget-class" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="pyamp.ui.qt.BaseWidget">
<em class="property">class </em><tt class="descclassname">pyamp.ui.qt.</tt><tt class="descname">BaseWidget</tt><big>(</big><em>name=None</em>, <em>controller=None</em>, <em>mainWindow=None</em>, <em>logData=None</em>, <em>logColor=0</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtGui.QWidget</span></tt>, <a class="reference internal" href="_generated/pyamp_ui_qt_baseView.html#pyamp.ui.qt.baseView.BaseView" title="pyamp.ui.qt.baseView.BaseView"><tt class="xref py py-class docutils literal"><span class="pre">pyamp.ui.qt.baseView.BaseView</span></tt></a></p>
<p>The BaseWidget class provides an implementation of the
<tt class="xref py py-class docutils literal"><span class="pre">amp.ui.qt.BaseView</span></tt> class designed to set up and create a
<tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtGui.QWidget</span></tt> object.</p>
<p>This class provides serveral functions which can be overridden by
subclasses to easily add features to the BaseWidget. These functions
are called in the following order during the set up process:</p>
<blockquote>
<ol class="arabic simple">
<li>configure()</li>
<li>configureLayout()</li>
<li>createElements()</li>
<li>setupConnections()</li>
</ol>
</blockquote>
<ul class="simple">
<li>name &#8211; The name of the BaseWidget</li>
<li>controller &#8211; The controller for the BaseWidget</li>
<li>mainWindow &#8211; The main window</li>
<li>logData &#8211; The <a class="reference internal" href="logging.html#pyamp.logging.LogData" title="pyamp.logging.LogData"><tt class="xref py py-class docutils literal"><span class="pre">pyamp.logging.LogData</span></tt></a> object</li>
<li>logColor &#8211; The color to use for logging</li>
</ul>
<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.addElement">
<tt class="descname">addElement</tt><big>(</big><em>element</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.addElement" title="Permalink to this definition">¶</a></dt>
<dd><p>Add an element to the main layout.</p>
<ul class="simple">
<li>element &#8211; The element to add</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.addElements">
<tt class="descname">addElements</tt><big>(</big><em>elements</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.addElements" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a list of elements to the main layout.</p>
<ul class="simple">
<li>elements &#8211; The list of elements</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.addItem">
<tt class="descname">addItem</tt><big>(</big><em>item</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.addItem" title="Permalink to this definition">¶</a></dt>
<dd><p>Add an item to the main layout.</p>
<ul class="simple">
<li>item &#8211; The item to add</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.addWidget">
<tt class="descname">addWidget</tt><big>(</big><em>widget</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.addWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a widget to the main layout.</p>
<ul class="simple">
<li>widget &#8211; The widget to add</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.clear">
<tt class="descname">clear</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.clear" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove all of the child widgets and items currently for this
BaseWidget.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.clearItems">
<tt class="descname">clearItems</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.clearItems" title="Permalink to this definition">¶</a></dt>
<dd><p>Clear all the items from this BaseWidget.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.clearWidgets">
<tt class="descname">clearWidgets</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.clearWidgets" title="Permalink to this definition">¶</a></dt>
<dd><p>Clear all the widgets from this BaseWidget.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.configure">
<tt class="descname">configure</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.configure" title="Permalink to this definition">¶</a></dt>
<dd><p>Configure the view.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.configureLayout">
<tt class="descname">configureLayout</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.configureLayout" title="Permalink to this definition">¶</a></dt>
<dd><p>Configure the layout for this view.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.createElements">
<tt class="descname">createElements</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.createElements" title="Permalink to this definition">¶</a></dt>
<dd><p>Create the elements for this view. Return the list of widgets,
or items in the order that they should be added to the layout.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.createLayout">
<tt class="descname">createLayout</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.createLayout" title="Permalink to this definition">¶</a></dt>
<dd><p>Create the main layout.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.getItems">
<tt class="descname">getItems</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.getItems" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the list of child items for this BaseWidget.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.getWidgets">
<tt class="descname">getWidgets</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.getWidgets" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the list of child widgets for this BaseWidget.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.ui.qt.BaseWidget.layoutType">
<tt class="descname">layoutType</tt><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.layoutType" title="Permalink to this definition">¶</a></dt>
<dd><p>The layoutType property contains the type of layout to use for this
Widget. It should be a value from the <tt class="xref py py-class docutils literal"><span class="pre">LayoutType</span></tt> class.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.paintEvent">
<tt class="descname">paintEvent</tt><big>(</big><em>_event</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.paintEvent" title="Permalink to this definition">¶</a></dt>
<dd><p>Override the paintEvent function to allow StylSheets to work for
this QWidget.</p>
<dl class="docutils">
<dt>Note this function was taken from the documentation of style sheets</dt>
<dd>for custom QWidget classes.</dd>
</dl>
<ul class="simple">
<li>_event &#8211; The QPaintEvent</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.setMargins">
<tt class="descname">setMargins</tt><big>(</big><em>left=None</em>, <em>top=None</em>, <em>right=None</em>, <em>bottom=None</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.setMargins" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the content margins for this widget&#8217;s layout.</p>
<ul class="simple">
<li>left &#8211; The left margin</li>
<li>top &#8211; The top margin</li>
<li>right &#8211; The right margin</li>
<li>bottom &#8211; The bottom margin</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.setSpacing">
<tt class="descname">setSpacing</tt><big>(</big><em>spacing</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.setSpacing" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the spacing between components in the layout.</p>
<ul class="simple">
<li>spacing &#8211; The spacing</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.setStyleSheet">
<tt class="descname">setStyleSheet</tt><big>(</big><em>styleSheet</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.setStyleSheet" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the style sheet for this widget.</p>
<ul class="simple">
<li>styleSheet &#8211; The StyleSheet</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.setupConnections">
<tt class="descname">setupConnections</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.setupConnections" title="Permalink to this definition">¶</a></dt>
<dd><p>Set up any connections this view requires.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.BaseWidget.setupView">
<tt class="descname">setupView</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.setupView" title="Permalink to this definition">¶</a></dt>
<dd><p>Create and set up this view.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.ui.qt.BaseWidget.tabOrder">
<tt class="descname">tabOrder</tt><a class="headerlink" href="#pyamp.ui.qt.BaseWidget.tabOrder" title="Permalink to this definition">¶</a></dt>
<dd><p>The tabOrder property allows concrete widgets to set their tab order.
Each element in the list will be tab connected to the next element in
the list. The list will cycle around to the front so the final element
is tab connected to the first element.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-keyevents-class">
<h3>The KeyEvents class<a class="headerlink" href="#the-keyevents-class" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="pyamp.ui.qt.KeyEvents">
<em class="property">class </em><tt class="descclassname">pyamp.ui.qt.</tt><tt class="descname">KeyEvents</tt><a class="headerlink" href="#pyamp.ui.qt.KeyEvents" title="Permalink to this definition">¶</a></dt>
<dd><p>This class provided functions for dealing with
<tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtGui.QKeyEvent</span></tt> objects.</p>
<p>The main function of this class is to provide a method to convert a
<tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtGui.QKeyEvent</span></tt> object into a string representation of the
keys that were pressed in the given event.</p>
<dl class="classmethod">
<dt id="pyamp.ui.qt.KeyEvents.parse">
<em class="property">classmethod </em><tt class="descname">parse</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.KeyEvents.parse" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse the given QKeyEvent into the string representation of
the keys pressed.</p>
<ul class="simple">
<li>event &#8211; The QKeyEvent</li>
</ul>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-stylesheet-class">
<h3>The StyleSheet class<a class="headerlink" href="#the-stylesheet-class" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="pyamp.ui.qt.StyleSheet">
<em class="property">class </em><tt class="descclassname">pyamp.ui.qt.</tt><tt class="descname">StyleSheet</tt><big>(</big><em>widget=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.StyleSheet" title="Permalink to this definition">¶</a></dt>
<dd><p>The StyleSheet class provides a wrapper for <tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtGui.QWidget</span></tt>
style sheet strings. StyleSheets can be easily created an exported into a
string that is properly formatted for setting the style sheet of a
<tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtGui.QWidget</span></tt>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">PyQt4.QtGui</span> <span class="kn">import</span> <span class="n">QApplication</span><span class="p">,</span> <span class="n">QWidget</span>
<span class="kn">from</span> <span class="nn">pyamp.ui.qt</span> <span class="kn">import</span> <span class="n">StyleSheet</span>

<span class="c"># Create the widget, and set its name</span>
<span class="n">app</span> <span class="o">=</span> <span class="n">QApplication</span><span class="p">([])</span>
<span class="n">widget</span> <span class="o">=</span> <span class="n">QWidget</span><span class="p">()</span>
<span class="n">widget</span><span class="o">.</span><span class="n">setObjectName</span><span class="p">(</span><span class="s">&quot;ObjectName&quot;</span><span class="p">)</span>

<span class="c"># Create a simple style sheet</span>
<span class="n">style</span> <span class="o">=</span> <span class="n">StyleSheet</span><span class="p">(</span><span class="n">border</span><span class="o">=</span><span class="s">&quot;2px solid black&quot;</span><span class="p">)</span>
<span class="n">normal</span> <span class="o">=</span> <span class="s">&quot;border: 2px solid black&quot;</span>

<span class="c"># These calls are identical</span>
<span class="n">widget</span><span class="o">.</span><span class="n">setStyleSheet</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">style</span><span class="p">))</span>
<span class="n">widget</span><span class="o">.</span><span class="n">setStyleSheet</span><span class="p">(</span><span class="n">normal</span><span class="p">)</span>

<span class="c"># Create another style sheet, notice that underscores in the</span>
<span class="c"># StylSheet parameter names are converted to dashes in the</span>
<span class="c"># style sheet string</span>
<span class="n">style</span> <span class="o">=</span> <span class="n">StyleSheet</span><span class="p">(</span><span class="n">background_color</span><span class="o">=</span><span class="s">&quot;red&quot;</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">&quot;blue&quot;</span><span class="p">,</span>
                   <span class="n">font_weight</span><span class="o">=</span><span class="s">&quot;bold&quot;</span><span class="p">)</span>
<span class="n">normal</span> <span class="o">=</span> <span class="s">&quot;background-color: red; color: blue; font-weight: bold&quot;</span>

<span class="c"># These calls are identical</span>
<span class="n">widget</span><span class="o">.</span><span class="n">setStyleSheet</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">style</span><span class="p">))</span>
<span class="n">widget</span><span class="o">.</span><span class="n">setStyleSheet</span><span class="p">(</span><span class="n">normal</span><span class="p">)</span>

<span class="c"># You can also specify a specific CSS selector string, which can be</span>
<span class="c"># either a specific string, or a widget. If given a widget, the</span>
<span class="c"># selector will be created using the object&#39;s class name (e.g.,</span>
<span class="c"># QWidget) and will append an ID selector with the object&#39;s name (if</span>
<span class="c"># and only if the widget is named).</span>
<span class="n">style1</span> <span class="o">=</span> <span class="n">StyleSheet</span><span class="p">(</span><span class="n">widget</span><span class="o">=</span><span class="s">&quot;QWidget#ObjectName&quot;</span><span class="p">,</span>
                    <span class="n">border</span><span class="o">=</span><span class="s">&quot;1px solid red&quot;</span><span class="p">,</span> <span class="n">margin_top</span><span class="o">=</span><span class="s">&quot;10&quot;</span><span class="p">)</span>
<span class="n">style2</span> <span class="o">=</span> <span class="n">StyleSheet</span><span class="p">(</span><span class="n">widget</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="s">&quot;1px solid red&quot;</span><span class="p">,</span> <span class="n">margin_top</span><span class="o">=</span><span class="s">&quot;10&quot;</span><span class="p">)</span>
<span class="n">normal</span> <span class="o">=</span> <span class="s">&quot;QWidget#ObjectName { border: 1px solid red; margin-top: 10;&quot;</span>

<span class="c"># These calls are identical</span>
<span class="n">widget</span><span class="o">.</span><span class="n">setStyleSheet</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">style1</span><span class="p">))</span>
<span class="n">widget</span><span class="o">.</span><span class="n">setStyleSheet</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">style2</span><span class="p">))</span>
<span class="n">widget</span><span class="o">.</span><span class="n">setStyleSheet</span><span class="p">(</span><span class="n">normal</span><span class="p">)</span>
</pre></div>
</div>
<ul>
<li><dl class="first docutils">
<dt>widget &#8211; The widget selector for this style sheet. Can be either a</dt>
<dd><p class="first last">string, or an actual widget object</p>
</dd>
</dl>
</li>
<li><p class="first">kwargs &#8211; The keyword arguments</p>
</li>
</ul>
</dd></dl>

</div>
<div class="section" id="the-resizepolicy-class">
<h3>The ResizePolicy class<a class="headerlink" href="#the-resizepolicy-class" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="pyamp.ui.qt.ResizePolicy">
<em class="property">class </em><tt class="descclassname">pyamp.ui.qt.</tt><tt class="descname">ResizePolicy</tt><a class="headerlink" href="#pyamp.ui.qt.ResizePolicy" title="Permalink to this definition">¶</a></dt>
<dd><p>The ResizePolicy encapsulates a specific policy for resizing widgets.</p>
<p>The possible resize policies are:</p>
<blockquote>
<ul class="simple">
<li><strong>Fixed</strong> &#8211; The size never changes</li>
<li><strong>Expanding</strong> &#8211; The size expands</li>
</ul>
</blockquote>
<p>For a specific policy, the ResizePolicy class can return the correct size
for a widget, given the widget&#8217;s current size as well as the size of all
of the widget&#8217;s child widgets.</p>
<p>For the <em>Fixed</em> resize policy: the size will always remain the same.</p>
<p>For the <em>Expanding</em> resize policy: the size will always expand to fit all
of the widget&#8217;s children.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">PyQt4</span> <span class="kn">import</span> <span class="n">QtCore</span>
<span class="kn">from</span> <span class="nn">pyamp.ui.qt</span> <span class="kn">import</span> <span class="n">ResizePolicy</span>

<span class="c"># Create the size of the widget, and the list of sizes for all of</span>
<span class="c"># the widget&#39;s children</span>
<span class="n">size</span> <span class="o">=</span> <span class="n">QtCore</span><span class="o">.</span><span class="n">QSize</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">200</span><span class="p">)</span>
<span class="n">childSizes</span> <span class="o">=</span> <span class="p">[</span><span class="n">QtCore</span><span class="o">.</span><span class="n">QSize</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span> <span class="mi">500</span><span class="p">),</span> <span class="n">QtCore</span><span class="o">.</span><span class="n">QSize</span><span class="p">(</span><span class="mi">300</span><span class="p">,</span> <span class="mi">400</span><span class="p">)]</span>

<span class="c"># Get the list of widths and heights for the child widgets</span>
<span class="n">childWidths</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">QtCore</span><span class="o">.</span><span class="n">QSize</span><span class="o">.</span><span class="n">width</span><span class="p">,</span> <span class="n">childSizes</span><span class="p">)</span>
<span class="n">childHeights</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">QtCore</span><span class="o">.</span><span class="n">QSize</span><span class="o">.</span><span class="n">width</span><span class="p">,</span> <span class="n">childSizes</span><span class="p">)</span>

<span class="c"># Both of these return: 100</span>
<span class="c"># Which is the given value of width</span>
<span class="n">ResizePolicy</span><span class="o">.</span><span class="n">getSize</span><span class="p">(</span><span class="n">ResizePolicy</span><span class="o">.</span><span class="n">Fixed</span><span class="p">,</span> <span class="n">size</span><span class="o">.</span><span class="n">width</span><span class="p">(),</span> <span class="n">childWidths</span><span class="p">)</span>
<span class="n">ResizePolicy</span><span class="o">.</span><span class="n">getWidth</span><span class="p">(</span><span class="n">ResizePolicy</span><span class="o">.</span><span class="n">Fixed</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="n">childSizes</span><span class="p">)</span>

<span class="c"># Both of these return: 900</span>
<span class="c"># Which is the sum of the childHeights list</span>
<span class="n">ResizePolicy</span><span class="o">.</span><span class="n">getSize</span><span class="p">(</span><span class="n">ResizePolicy</span><span class="o">.</span><span class="n">Expanding</span><span class="p">,</span> <span class="n">size</span><span class="o">.</span><span class="n">height</span><span class="p">(),</span>
                     <span class="n">childHeights</span><span class="p">)</span>
<span class="n">ResizePolicy</span><span class="o">.</span><span class="n">getHeight</span><span class="p">(</span><span class="n">ResizePolicy</span><span class="o">.</span><span class="n">Fixed</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="n">childSizes</span><span class="p">)</span>
</pre></div>
</div>
<dl class="classmethod">
<dt id="pyamp.ui.qt.ResizePolicy.getHeight">
<em class="property">classmethod </em><tt class="descname">getHeight</tt><big>(</big><em>policy</em>, <em>size</em>, <em>sizeList</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ResizePolicy.getHeight" title="Permalink to this definition">¶</a></dt>
<dd><p>For the given resize policy, get the correct height for the size of
the widget as well as the size of all of the widget&#8217;s children.</p>
<ul class="simple">
<li>resizePolicy &#8211; The resize policy</li>
<li>size &#8211; The main <tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtCore.QSize</span></tt> of the widget</li>
<li>sizeList &#8211; The list of <tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtCore.QSize</span></tt> for sub widgets</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.ui.qt.ResizePolicy.getSize">
<em class="property">classmethod </em><tt class="descname">getSize</tt><big>(</big><em>policy</em>, <em>size</em>, <em>sizeList</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ResizePolicy.getSize" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the correct size based on the given resize policy.</p>
<ul>
<li><p class="first">resizePolicy &#8211; The resize policy</p>
</li>
<li><p class="first">size &#8211; The main single size (width or height) of the widget</p>
</li>
<li><dl class="first docutils">
<dt>sizeList &#8211; The list of the single dimension size (widths or heights)</dt>
<dd><p class="first last">of widgets&#8217;s children</p>
</dd>
</dl>
</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.ui.qt.ResizePolicy.getWidth">
<em class="property">classmethod </em><tt class="descname">getWidth</tt><big>(</big><em>policy</em>, <em>size</em>, <em>sizeList</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ResizePolicy.getWidth" title="Permalink to this definition">¶</a></dt>
<dd><p>For the given resize policy, get the correct width for the size of
the widget as well as the size of all of the widget&#8217;s children.</p>
<ul class="simple">
<li>resizePolicy &#8211; The resize policy</li>
<li>size &#8211; The main <tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtCore.QSize</span></tt> of the widget</li>
<li>sizeList &#8211; The list of <tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtCore.QSize</span></tt> for sub widgets</li>
</ul>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-widgetlist-class">
<h3>The WidgetList class<a class="headerlink" href="#the-widgetlist-class" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="pyamp.ui.qt.WidgetList">
<em class="property">class </em><tt class="descclassname">pyamp.ui.qt.</tt><tt class="descname">WidgetList</tt><big>(</big><em>name=None</em>, <em>controller=None</em>, <em>mainWindow=None</em>, <em>logData=None</em>, <em>logColor=0</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.WidgetList" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="_generated/pyamp_ui_qt_baseWidget.html#pyamp.ui.qt.baseWidget.BaseWidget" title="pyamp.ui.qt.baseWidget.BaseWidget"><tt class="xref py py-class docutils literal"><span class="pre">pyamp.ui.qt.baseWidget.BaseWidget</span></tt></a></p>
<p>The WidgetList class defines a BaseWidget object that has the ability
to display a list of widgets vertically one after the other. This class
handles resizing the widget appropriately based on the widgets that
are in the list.</p>
<ul class="simple">
<li>name &#8211; The name of the BaseWidget</li>
<li>controller &#8211; The controller for the BaseWidget</li>
<li>mainWindow &#8211; The main window</li>
<li>logData &#8211; The <a class="reference internal" href="logging.html#pyamp.logging.LogData" title="pyamp.logging.LogData"><tt class="xref py py-class docutils literal"><span class="pre">pyamp.logging.LogData</span></tt></a> object</li>
<li>logColor &#8211; The color to use for logging</li>
</ul>
<dl class="method">
<dt id="pyamp.ui.qt.WidgetList.addItem">
<tt class="descname">addItem</tt><big>(</big><em>item</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.WidgetList.addItem" title="Permalink to this definition">¶</a></dt>
<dd><p>Add an item to the widget list.</p>
<ul class="simple">
<li>item &#8211; The item to add</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.WidgetList.addWidget">
<tt class="descname">addWidget</tt><big>(</big><em>widget</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.WidgetList.addWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a widget to this widget list.</p>
<ul class="simple">
<li>widget &#8211; The widget to add</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.WidgetList.clear">
<tt class="descname">clear</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.WidgetList.clear" title="Permalink to this definition">¶</a></dt>
<dd><p>Clear all the widgets from the list.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.WidgetList.setHorizontalRezizePolicy">
<tt class="descname">setHorizontalRezizePolicy</tt><big>(</big><em>policy</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.WidgetList.setHorizontalRezizePolicy" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the horizontal resize policy.</p>
<ul class="simple">
<li>policy &#8211; The new resize policy</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.WidgetList.setMargin">
<tt class="descname">setMargin</tt><big>(</big><em>margin</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.WidgetList.setMargin" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the margin for this widget list.</p>
<ul class="simple">
<li>margin &#8211; The margin to use</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.WidgetList.setVerticalResizePolicy">
<tt class="descname">setVerticalResizePolicy</tt><big>(</big><em>policy</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.WidgetList.setVerticalResizePolicy" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the vertical resize policy.</p>
<ul class="simple">
<li>policy &#8211; The new resize policy</li>
</ul>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-scrollablelist-class">
<h3>The ScrollableList class<a class="headerlink" href="#the-scrollablelist-class" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="pyamp.ui.qt.ScrollableList">
<em class="property">class </em><tt class="descclassname">pyamp.ui.qt.</tt><tt class="descname">ScrollableList</tt><big>(</big><em>name=None</em>, <em>controller=None</em>, <em>mainWindow=None</em>, <em>logData=None</em>, <em>logColor=0</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ScrollableList" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="_generated/pyamp_ui_qt_baseWidget.html#pyamp.ui.qt.baseWidget.BaseWidget" title="pyamp.ui.qt.baseWidget.BaseWidget"><tt class="xref py py-class docutils literal"><span class="pre">pyamp.ui.qt.baseWidget.BaseWidget</span></tt></a></p>
<p>The ScrollableList class creates a BaseWidget that contains a
QScrollArea which displays a WidgetList inside of the scroll area. This
allows a the user to scroll through the WidgetList to see previously added
widgets.</p>
<p>In order to fix the size of the scroll area, subclasses of ScrollableList
should set the <em>size</em> class property which is a QSize object.</p>
<ul class="simple">
<li>name &#8211; The name of the BaseWidget</li>
<li>controller &#8211; The controller for the BaseWidget</li>
<li>mainWindow &#8211; The main window</li>
<li>logData &#8211; The <a class="reference internal" href="logging.html#pyamp.logging.LogData" title="pyamp.logging.LogData"><tt class="xref py py-class docutils literal"><span class="pre">pyamp.logging.LogData</span></tt></a> object</li>
<li>logColor &#8211; The color to use for logging</li>
</ul>
<dl class="method">
<dt id="pyamp.ui.qt.ScrollableList.addItem">
<tt class="descname">addItem</tt><big>(</big><em>item</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.addItem" title="Permalink to this definition">¶</a></dt>
<dd><p>Add an item to the ScrollabelList widget.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.ScrollableList.addWidget">
<tt class="descname">addWidget</tt><big>(</big><em>widget</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.addWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a widget to the ScrollableList widget.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.ScrollableList.clearWidgets">
<tt class="descname">clearWidgets</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.clearWidgets" title="Permalink to this definition">¶</a></dt>
<dd><p>Clear all of the widgets from the ScrollableList.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.ScrollableList.createElements">
<tt class="descname">createElements</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.createElements" title="Permalink to this definition">¶</a></dt>
<dd><p>Override the BaseWidget createElements class.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.ScrollableList.getScrollArea">
<tt class="descname">getScrollArea</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.getScrollArea" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the QScrollArea for this widget.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.ScrollableList.getWidgetList">
<tt class="descname">getWidgetList</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.getWidgetList" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the WidgetList for this ScrollabeList.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.ui.qt.ScrollableList.horizontalPolicy">
<tt class="descname">horizontalPolicy</tt><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.horizontalPolicy" title="Permalink to this definition">¶</a></dt>
<dd><p>The horizontalPolicy property contains the <a class="reference internal" href="_generated/pyamp_ui_qt_scrollableList.html#pyamp.ui.qt.scrollableList.ScrollBarPolicy" title="pyamp.ui.qt.scrollableList.ScrollBarPolicy"><tt class="xref py py-class docutils literal"><span class="pre">ScrollBarPolicy</span></tt></a>
for the horizontal scrollbar.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.ui.qt.ScrollableList.margin">
<tt class="descname">margin</tt><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.margin" title="Permalink to this definition">¶</a></dt>
<dd><p>The margin property contains the margin between all items in the list.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.ScrollableList.scroll">
<tt class="descname">scroll</tt><big>(</big><em>amount</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.scroll" title="Permalink to this definition">¶</a></dt>
<dd><p>Scroll the vertical scrollbar by the given amount.</p>
<ul>
<li><dl class="first docutils">
<dt>amount &#8211; The amount to scroll (negative being scrolling up, and</dt>
<dd><p class="first last">is positive scrolling down)</p>
</dd>
</dl>
</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.ScrollableList.scrollTo">
<tt class="descname">scrollTo</tt><big>(</big><em>y=0</em><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.scrollTo" title="Permalink to this definition">¶</a></dt>
<dd><p>Scroll to the given position.</p>
<ul class="simple">
<li>y &#8211; The y position to scroll to</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.ScrollableList.scrollToBottom">
<tt class="descname">scrollToBottom</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.scrollToBottom" title="Permalink to this definition">¶</a></dt>
<dd><p>Scroll to the bottom of the list.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.ScrollableList.scrollToTop">
<tt class="descname">scrollToTop</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.scrollToTop" title="Permalink to this definition">¶</a></dt>
<dd><p>Scroll to the top of the list.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.ui.qt.ScrollableList.size">
<tt class="descname">size</tt><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.size" title="Permalink to this definition">¶</a></dt>
<dd><p>The size property contains the size of the scrollable list.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.qt.ScrollableList.sizeHint">
<tt class="descname">sizeHint</tt><big>(</big><big>)</big><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.sizeHint" title="Permalink to this definition">¶</a></dt>
<dd><p>Override the QWidget sizeHint function to return the size of this
ScrollableList.</p>
</dd></dl>

<dl class="attribute">
<dt id="pyamp.ui.qt.ScrollableList.verticalPolicy">
<tt class="descname">verticalPolicy</tt><a class="headerlink" href="#pyamp.ui.qt.ScrollableList.verticalPolicy" title="Permalink to this definition">¶</a></dt>
<dd><p>The verticalPolicy property contains the <a class="reference internal" href="_generated/pyamp_ui_qt_scrollableList.html#pyamp.ui.qt.scrollableList.ScrollBarPolicy" title="pyamp.ui.qt.scrollableList.ScrollBarPolicy"><tt class="xref py py-class docutils literal"><span class="pre">ScrollBarPolicy</span></tt></a>
for the vertical scrollbar.</p>
</dd></dl>

</dd></dl>

</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">The ui module</a><ul>
<li><a class="reference internal" href="#module-pyamp.ui.input">The input module</a><ul>
<li><a class="reference internal" href="#module-pyamp.ui.input.evdev">The evdev module</a></li>
<li><a class="reference internal" href="#the-consoleinput-class">The ConsoleInput class</a></li>
<li><a class="reference internal" href="#the-keys-class">The Keys class</a></li>
<li><a class="reference internal" href="#the-userinput-class">The UserInput class</a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-pyamp.ui.qt">The qt module</a><ul>
<li><a class="reference internal" href="#the-baseview-class">The BaseView class</a></li>
<li><a class="reference internal" href="#the-basewidget-class">The BaseWidget class</a></li>
<li><a class="reference internal" href="#the-keyevents-class">The KeyEvents class</a></li>
<li><a class="reference internal" href="#the-stylesheet-class">The StyleSheet class</a></li>
<li><a class="reference internal" href="#the-resizepolicy-class">The ResizePolicy class</a></li>
<li><a class="reference internal" href="#the-widgetlist-class">The WidgetList class</a></li>
<li><a class="reference internal" href="#the-scrollablelist-class">The ScrollableList class</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/ui.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="index.html">pyamp v1.2 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, Brett Ponsler.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
    </div>
  </body>
</html>